<?
/**
* <b>Config Class</b>
*
* base class storing default config properties of the application (site).
* All properties can (and should, usually) be overridden
*
* @package gravy
* @class config
*/
class config{
	/**
	* <b>$database</b>
	* Default database connection settings
	* Each subclass of config can specify its own database connection
	* @var map<string,string>
	*/
	public $database=array(
		"server"=>"mysqli",
		"domain"=>"localhost",
		"database"=>"db_app",
		"user"=>"root",
		"password"=>"password",
		"socket"=>"/var/mysql/mysql.sock"
	);

	
	 /**
	 * <b>$default_page_title</b>
	 * The default page title
	 * @var 
	 */
	public $default_page_title="Gravy - the source that makes your site.";

	
	/**
	* <b>$CACHE</b>
	*Cache the document and elements?
	* @var bool
	*/	
	public $CACHE=true;

	/**
	* <b>$log</b>
	* location to the log file: must have write priv's
	* @var string
	*/
	public $log="logs/app.log";


		
	/**
	* <b>$sessionKey</b>
	* each application will require this to be somehow unique
	* making two sites the same will result in them sharing cookies in some form
	* @var string
	*/
	public $sessionKey="someApplicationSpecificUniqueKey";


		
	/**
	* <b>$debug</b>	
	* enabling debugging by default will result in debug messages being rendered
	* across the site/application
	* by default, this is set to the query string value, allowing you to add ?debug=true
	* to any request, resulting in all debug calls being rendered
	* @var string 
	*/
	public $debug=DEBUG;


 
	/**
	* <b>default_theme, default_view, default_controller</b>
	* these will be used if none is supplied through the query string
	* @var string
	*/
	public $default_theme      = "default";
	public $default_view       = "default";
	public $default_controller = "default";


	/**
	* <b>$uploadsPath</b>
	* where files (by default) are uploaded to
	* remember, this needs full read/write access and be infront of the WEB_ROOT/.
	* @var 
	*/
	public $uploadsPath="public/";


	
	/**
	* <b>$default_format</b>
	* could be any of the supported formats
	* html, xml, csv etc
	* @var string
	*/
	public $default_format="html";


	
	/**
	* <b>$error_theme</b>	
	* The template to use when an error has occured.
	* Leave null to use the default template, or the template that was attempted to be loaded.
	* Note: This must be a valid file in the themes directory.
	* Example:
	*   public $error_theme="error";
	* @var string
	*/
	public $error_theme=null;

	 
	/**
	* <b>$USE_ENCRYPTION</b>
	* Use Encryption?
	* @var bool
	*/
	public $USE_ENCRYPTION = true;

		
	/**
	* <b>$NICE_DEBUG</b>
	* Output debugs nicely (i.e. within the template)
	* @var bool
	*/
	public $NICE_DEBUG = true;

	
	/**
	* <b>$RC4_KEY</b>
	* RC4 Encryption Key
	* @var string
	*/
	public $RC4_KEY = "gravyrc4Key";

	
	/**
	* <b>$SALT</b>
	* A string to salt encryption for extra security (make between 1 and 10 characters)
	* @var string
	*/
	public $SALT = "hmmSalty";

	
	/**
	* <b>$recordsPerPage</b>
	* Paging Setting
	* The default maximum number of records to display on a paged report
	* @var 
	*/
	public $recordsPerPage = 30;

	
	/**
	* <b>__construct</b>
	*
	* Constructor, calls init() to perform initialise
	*
	* @fn __construct	
	* @return void
	*/	
	function __construct(){
		#ini_set("mysqli.default_socket",$this->database['socket']);
		$this->init();
	}
	
	/**
	* <b>init</b>
	*
	* Sets log file, converts "true"/"false"/null of debug into "ON" / "OFF" / "HIDDEN"
	*
	* @fn init	
	* @return void
	*/	
	public function init(){
		$this->log=GRAVY_ROOT_DIR.$this->log;
		
		if($this->debug==="1"||strtoupper($this->debug)==="TRUE"){
			$this->debug="ON";
		}
		if($this->debug==="0"||strtoupper($this->debug)==="FALSE"){
			$this->debug="OFF";
		}
		if(strtoupper($this->debug)==="HIDDEN"){
			$this->debug="HIDDEN";
		}
	}
};
?>
